import { defineStore } from "pinia";
import axios from 'axios'
import { ref } from "vue";
export const useNewListStore=defineStore('newList',()=>{
    // setup函数
    const newsList=ref([])
    const getList=async (id)=>{
            const res=await axios.get(`http://geek.itheima.net/v1_0/articles?channel_id=${id}&timestamp=${Date.now()}`)
            newsList.value=res.data.data.results
            console.log(res);
    }
    return {
        newsList,
        getList 
    }
})